package com.summer.learn.views;

import org.springframework.stereotype.Component;
import org.springframework.web.servlet.View;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;

// 由于 BeanNameViewResolver 会更具名字从IOC容器中取bean对象用于渲染，所以自定义的View需要使用 @Component 注册到bean容器里
@Component
public class SummerView implements View {
    @Override
    public String getContentType() {
        return "text/html";
    }

    @Override
    public void render(Map<String, ?> model, HttpServletRequest request, HttpServletResponse response) throws Exception {
        response.getWriter().print("这是一个自定义渲染View可以在这里做自定义的渲染，拼接，表格报表");
    }
}
